package omit.wage.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import omit.wage.result.PageResult;
import omit.wage.dto.BankPageDTO;
import omit.wage.vo.BankVO;
import omit.wage.mapper.BankMapper;
import omit.wage.service.IBankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author author
 * @since 2024-06-11
 */
@Service
public class BankServiceImpl implements IBankService {
    @Autowired
    private BankMapper bankMapper;
    //分页查询
    public PageResult pageQuery(BankPageDTO bankPageDTO){
        //开始分页查询
        PageHelper.startPage(bankPageDTO.getPage(), bankPageDTO.getPageSize());

        Page<BankVO> page = bankMapper.pageQuery(bankPageDTO);

        long total = page.getTotal();
        List<BankVO> rows = page.getResult();
        return new PageResult(total, rows);
    }
}
